from pymilvus import connections, utility, Collection, CollectionSchema, FieldSchema, DataType
import numpy as np

# --- 1. 连接 Milvus ---
# 默认别名为 "default"，主机为 "localhost"，端口为 "19530"
try:
    connections.connect("default", host="localhost", port="19530")
    print("🎉 连接 Milvus 成功!")
except Exception as e:
    print(f"❌ 连接 Milvus 失败: {e}")
    exit()